<?php
/**
 * Получение данных о сообществе по id 
 *
 * @package default
 * @author Alexander Sibiryakov
 **/
class AggregatedModel_ItemProcessor_CommunityField extends AggregatedModel_ItemProcessor_Common implements AggregatedModel_ItemProcessor_Interface
{
	private $mm;
	
	public function __construct($rh) {
		$this->mm = $rh->ctx->mm;
	}
	
	public function processItem(array $data) {

		if (is_numeric($data['community_oid'])) {
			
			$community = $this->mm->getModel("Community", "m")->getCommunity( $data['community_oid'] );
			
			$data['community'] = $community->data;
			$data['community']['oid'] = $community->id;
			$data['community']['url'] = $community->data['community_url'];
		}
		return $data;
	}
} // END class
